<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>好家服务公寓酒店管理系统</title>
<load href='__PUBLIC__/Css/style.css' />
<load href='__PUBLIC__/Js/jquery-1.4.4.min.js' />
<script type="text/javascript">

   $(document).ready(function(){
        function shows(){
        	jQuery.post(
	        "__APP__/Index/getLatestData",
	        {
	        },
	        function(data){
	            data = data.data;
	            $('.show_data a').empty();
	            $('.live_checkin').empty();
	            $('.sumrent').empty();
	            $('.today_free_rooms').empty();
	            $('.member').append(data.count_member);
	            $('.new_msg').append(data.count_msgs);
	            $('.new_order').append(data.count_order);
	            $('.process_order').append(data.count_process_order);
	            $('.house').append(data.count_house);
	            $('.lesspay').append(data.count_lesspay);
	            $('.clean').append(data.count_clean);
	            $('.checkin').append(data.count_checkin);
	            $('.to_check').append(data.count_to_check);
	            $('.live_checkin').append(data.count_live_checkin);
	            $('.landlord').append(data.count_landlord);
	            $('.todo').append(data.count_todo);
	            $('.sumrent').append(data.sumRentCost);
	            $('.today_free_rooms').append(data.count_today_free_rooms);

	            //更新链接颜色
	            	$(".show_data a").removeClass("normCenterLink redCenterLink");
	            	$(".show_data td").removeClass("normCenterLink redCenterLink"); 
	            	data.count_msgs == 0 ? $('.new_msg').addClass('normCenterLink') : $('.new_msg').addClass('redCenterLink');
	            	data.count_member == 0 ? $('.member').addClass('normCenterLink') : $('.member').addClass('redCenterLink');
	            	data.count_order == 0 ? $('.new_order').addClass('normCenterLink') : $('.new_order').addClass('redCenterLink');
	            	data.count_process_order == 0 ? $('.process_order').addClass('normCenterLink') : $('.process_order').addClass('redCenterLink');
	            	data.count_house == 0 ? $('.house').addClass('normCenterLink') : $('.house').addClass('redCenterLink');
	            	data.count_lesspay == 0 ? $('.lesspay').addClass('normCenterLink') : $('.lesspay').addClass('redCenterLink');
	            	data.count_clean == 0 ? $('.clean').addClass('normCenterLink') : $('.clean').addClass('redCenterLink');
	            	data.count_checkin == 0 ? $('.checkin').addClass('normCenterLink') : $('.checkin').addClass('redCenterLink');
	            	data.count_live_checkin == 0 ? $('.live_checkin').addClass('normCenterLink') : $('.live_checkin').addClass('redCenterLink');
	            	data.count_landlord == 0 ? $('.landlord').addClass('normCenterLink') : $('.landlord').addClass('redCenterLink');

	            	data.count_todo == 0 ? $('.todo').addClass('normCenterLink') : $('.todo').addClass('redCenterLink');
	            	data.sumRentCost == 0 ? $('.sumrent').addClass('normCenterLink') : $('.sumrent').addClass('redCenterLink');
	            	data.count_today_free_rooms == 0 ? $('.today_free_rooms').addClass('normCenterLink') : $('.today_free_rooms').addClass('redCenterLink');
	            	data.count_to_check == 0 ? $('.to_check').addClass('normCenterLink') : $('.to_check').addClass('redCenterLink');

	            	if(data.alert_value == 0 ){
	            		if(data.count_msgs > 0 || data.count_member > 0 || data.count_order > 0)
	            		
	            		window.setTimeout('play_alert()', 100);
	            	}
	            	
	        },
	        'json'
	        );
        };
        setInterval(function(){shows();}, 5000);
     });

	function play_alert(){
		var sound = document.getElementById('sound');
		if(sound == null){
			var audio = document.getElementById('audio');
			audio.play();
		}else{
			sound.play();
		}
	}

    function backup(){
        location.href="__APP__/Backup";
    }

    function iFrameHeight() {   
		var ifm= document.getElementById("sframe");   
		var subWeb = document.frames ? document.frames["sframe"].document : ifm.contentDocument;   
		if(ifm != null && subWeb != null) {
		   //ifm.height = subWeb.body.scrollHeight;
		   var bHeight = ifm.contentWindow.document.body.scrollHeight;
			var dHeight = ifm.contentWindow.document.documentElement.scrollHeight;
			var height = Math.max(bHeight, dHeight);
			ifm.height = dHeight+70;
		}  
	}  

function close_all()
{
	document.getElementById('div1cdl1').style.display='none';
	document.getElementById('div1cdl2').style.display='none';
	document.getElementById('div1cdl3').style.display='none';
	document.getElementById('div1cdl4').style.display='none';
	document.getElementById('div1cdl5').style.display='none';
	document.getElementById('div1cdl6').style.display='none';
	document.getElementById('div1cdl7').style.display='none';
	document.getElementById('div1cdl8').style.display='none';
	document.getElementById('div1cdl9').style.display='none';
	document.getElementById('div1cdl10').style.display='none';
	document.getElementById('div1cdl11').style.display='none';
}

function biguse(element)
{
	
	var d=document.getElementById(element);
	
	if(d.style.display=='block')
	{	d.style.display="none";
	}
	else
	{	
		d.style.display="block";
	}
}

function use(element)
{
	
	var d=document.getElementById(element);
	
	if(d.style.display=='block')
	{	close_all();
	}
	else
	{	close_all();
		d.style.display="block";
	}
}

function use_close(element)
{
	
	var d=document.getElementById(element);
	
	if(d.style.display=='block')
	{
		d.style.display='none';
	
	}
	else
	{
		d.style.display="block";
	}
}



<!--
//指定当前组模块URL地址
var URL = '__URL__';
var APP	 =	 '__APP__';
var PUBLIC = '__PUBLIC__';
//-->


function get_detail(type){
	var use_div = '';
	var action_url = '';
	switch(type){
		case 'member':{
			use_div = 'div1cdl7';
			action_url =  APP+"/Index/getNewMembers";
			break;
		}
		case 'new_msg':{
			use_div = 'div1cdl3';
			action_url =  APP+"/Index/getNewMsg";
			break;
		}
		case 'new_order':{
			use_div = 'div1cdl1';
			action_url =  APP+"/Index/getOrders";
			break;
		}
		case 'process_order':{
			use_div = 'div1cdl2';
			action_url =  APP+"/Index/getProcessOrders";
			break;
		}
		case 'house':{
			use_div = 'div1cdl5';
			action_url =  APP+"/Index/getHouses";
			break;
		}
		case 'lesspay':{
			use_div = 'div1cdl6';
			action_url =  APP+"/Index/getLessPay";
			break;
		}
		case 'checkin':{
			use_div = 'div1cdl4';
			action_url =  APP+"/Index/getCheckins";
			break;
		}
		case 'clean':{
			use_div = 'div1cdl9';
			action_url =  APP+"/Index/getCleans";
			break;
		}
		case 'landlord':{
			use_div = 'div1cdl8';
			action_url =  APP+"/Index/getLandords";
			break;
		}
		case 'todo':{
			use_div = 'div1cdl10';
			action_url =  APP+"/Index/getTodos";
			break;
		}
		case 'to_check':{
			use_div = 'div1cdl11';
			action_url =  APP+"/Index/getToCheck";
			break;
		}

	}
	jQuery.post(
        action_url,
        {
        },
        function(data){
        	use(use_div);
            data = data.data;
            $('#'+type+'').empty();
            $('#'+type+'').append(data);
        },
        'json'
        );
		
}

</script>
</head>
<php>
    function getAlink($var){
        if($var != 0){
           return "redCenterLink";
        }else{
            return "normCenterLink";
        }
    }
</php>
<body>
<style type="text/css">
.list tr th{text-align: center;}
</style>
<div class="main panel-header" >
	<a href="#" onclick="biguse('count_alert')" style="display:block;">提醒统计</a>
<div class="content" id='count_alert' style="margin-bottom:10px;">
<TABLE id="checkList" class="list" cellpadding=0 cellspacing=0 >
	<tr>
		<th>新会员</th><th>新留言</th><th>新订单</th><th>处理中订单</th>
		<th>到期客户</th><th>欠款客户</th><th>待结账</th><th>待交租房间</th><th>待打扫房间</th>
		<th>个人工作台</th><th>今日入住</th><th>在住客户</th><th>今日空房</th><th>租金总额</th>
	</tr>
	<tr class="show_data">
		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('member')" class="{$count_member|getAlink} member">{$count_member}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'" ><a href="#" onclick="get_detail('new_msg')" class="{$count_msgs|getAlink} new_msg">{$count_msgs}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'" ><a href="#" onclick="get_detail('new_order')" class="{$count_order|getAlink} new_order">{$count_order}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('process_order')" class="{$count_process_order|getAlink} process_order">{$count_process_order}</a></TD>
		 
   
		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('house')" class="{$count_house|getAlink} house">{$count_house}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('lesspay')" class="{$count_lesspay|getAlink} lesspay">{$count_lesspay}</a></TD>
		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('to_check')" class="{$count_to_check|getAlink} to_check">{$count_to_check}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('landlord')" class="{$count_landlord|getAlink} landlord">{$count_landlord}</a></TD>
		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#clean" onclick="get_detail('clean')" class="{$count_clean|getAlink} clean">{$count_clean}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('todo')" class="{$count_todo|getAlink} todo">{$count_todo}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" onclick="get_detail('checkin')" class="{$count_checkin|getAlink} checkin">{$count_checkin}</a></TD>

		<TD onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'" class="{$count_live_checkin|getAlink} live_checkin">{$count_live_checkin}</TD>
		<td onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'"><a href="#" class="{$count_today_free_rooms|getAlink} today_free_rooms">{$count_today_free_rooms}</a></td>
		<!--
		<td onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'" class="{$count_today_free_rooms|getAlink} today_free_rooms">{$count_today_free_rooms}</td> -->
		<td onmouseover="this.style.background='#ffff80'" onmouseout="this.style.background='#ffffff'" class="{$count_live_checkin|getAlink} sumrent">{$sumRentCost}</td>

	</tr>
</TABLE>
	<div id="div1cdl1" class="text">
    <table id="new_order_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl1')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">新预订</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	<table id="new_order" class="list" cellpadding="0" cellspacing="0">
	    
	        
	</table>
	</div>
	
	<div id="div1cdl2" class="text">
    <table id="process_order_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl2')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">处理中订单</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
    <table id="process_order" class="list" cellpadding="0" cellspacing="0">
	</table>
	</div>
	
	<div id="div1cdl3" class="text">
	<table id="new_msg_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl3')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">新留言</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	<table id="new_msg" class="list" cellpadding="0" cellspacing="0">
	   
	</table>
	</div>
	
	<div id="div1cdl4" class="text">
	<table id="checkin_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl4')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">今日入住客户</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	<table id="checkin" class="list" cellpadding="0" cellspacing="0"></table>
	</div>
	
	<div id="div1cdl5" class="text">
	<table id="house_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl5')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">到期客户</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	<table id="house" class="list" cellpadding="0" cellspacing="0">	</table>
	</div>
	
	<div id="div1cdl6" class="text">
	<table id="lesspay_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl6')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">欠款客户</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	<table id="lesspay" class="list" cellpadding="0" cellspacing="0"></table>
	</div>
	
	<div id="div1cdl7" class="text">
	<table id="member_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl7')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">今日新会员</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
    
	<table id="member" class="list" cellpadding="0" cellspacing="0">
	    
	</table>
	</div>
	
	<div id="div1cdl8" class="text">
	<table id="landlord_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl8')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">待交租房间</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	    <table id="landlord" class="list" cellpadding="0" cellspacing="0"></table>
	</div>
	
	<div id="div1cdl9" class="text">
		<table id="clean_cdl" class="list" cellpadding="0" cellspacing="0">
	    <caption onclick="use_close('div1cdl9')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">待打扫房间</caption>
	    <tr><td height="0" colspan="0" class="topTd"></td></tr>
	    </table>
	    
	    <table id="clean" class="list" cellpadding="0" cellspacing="0"></table>
	</div>

	<div id="div1cdl10" class="text">
		<table id="todo_cdl" class="list" cellpadding="0" cellspacing="0">
	    <caption onclick="use_close('div1cdl10')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">待办事项</caption>
	    <tr><td height="0" colspan="0" class="topTd"></td></tr>
	    </table>
	    
	    <table id="todo" class="list" cellpadding="0" cellspacing="0"></table>
	</div>

	<div id="div1cdl11" class="text">
	<table id="to_check_cdl" class="list" cellpadding="0" cellspacing="0">
    <caption onclick="use_close('div1cdl11')" onmouseout="this.style.background='#ffffff'" onmouseover="this.style.background='#ffff80'">待结账</caption>
    <tr><td height="0" colspan="0" class="topTd"></td></tr>
    </table>
    
	<table id="to_check" class="list" cellpadding="0" cellspacing="0"></table>
	</div>
</div>

<!--
	<div>
		<a class="panel-header" style="padding-right:1000px;" href="#" onclick="biguse('housestats')">房态信息</a> 
	</div>
-->
	<div id="housestats">
			<iframe SRC="__APP__/Housestats/index" FRAMEBORDER=0 id="sframe" name="sframe" scrolling=0  height="auto" onload="iFrameHeight()" width="100%">
		</iframe>
	</div>
</div>
<!-- 主页面结束 -->
{// 加载声音提醒 }
 <eq name="alert_value" value = "0">

   <php>if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE")>0 ){</php>
       <embed id="sound" src="__PUBLIC__/Sound/pm_1.wav" width="0" height="0"  autostart="false" />
    <php>
            }else{
            </php>
			<audio id="audio">
            <source src="http://down.159.com/bells/user/2011/12/10/jiker201111501815989.ogg" type="audio/ogg">
Your browser does not support the audio element.
        </audio>

        <php>
            }
        </php>
    </eq>
